package com.mio.web.service.moive;

import java.util.List;

import org.durcframework.core.expression.ExpressionQuery;
import org.durcframework.core.expression.SqlContent;
import org.durcframework.core.service.CrudService;
import org.springframework.stereotype.Service;

import com.mio.web.common.MioUtil;
import com.mio.web.dao.moive.MovieDao;
import com.mio.web.entity.moive.Movie;

@Service
public class MovieService extends CrudService<Movie, MovieDao> {
	
	/**
	 * 获取最上面的视频数据，先根据sortId，在根据id进行排序查询
	 * @return
	 */
	public Movie getIndexMoive() {
		ExpressionQuery query = new ExpressionQuery();
		query.addSort("sortId",SqlContent.DESC);
		query.addSort("id",SqlContent.DESC);
		List<Movie> list = getDao().find(query);
		if(MioUtil.listIsEmpty(list)){
			return list.get(0);
		}
		return null;
	}

}